const { Article } = require('../../model/article');
module.exports = async(req, res) => {
    req.app.locals.current = 'article';
    // res.render('admin/article-edit');
    const { id } = req.query;
    // res.send(id);
    // 修改
    if (id) {
        let article = await Article.findOne({ _id: id });
        res.render('admin/article-edit', {
            article: article,
            link: '/admin/article-modify?id=' + id
        });
        // res.send(article);
        // return;
    } else {
        // 添加
        res.render('admin/article-edit', {
            link: '/admin/article-add'
        });

    }
};